﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;

namespace _14._3
{

    [Serializable]
    public class GameOptions
    {
        private ObservableCollection<string> playerNames = new ObservableCollection<string>();
        public List<string> SelectedPlayers { get; set; } = new List<string>();
        private bool playAgainstComput = true;
        private int numberOfPlayers = 2;
        private ComputerSkillLevel skillLevel = ComputerSkillLevel.Good;
        public bool PlayAgainstComput { get { return playAgainstComput; } set { playAgainstComput = value; OnPropertyChaned(nameof(PlayAgainstComput)); } }
        public int NumberOfPlayers
        {
            get
            {
                return numberOfPlayers;
            }
            set
            {
                numberOfPlayers = value;
                OnPropertyChaned(nameof(NumberOfPlayers));
            }
        }

        public ComputerSkillLevel ComputerSkill
        {
            get { return skillLevel; }
            set { skillLevel = value; OnPropertyChaned(nameof(skillLevel)); }
        }

        public ObservableCollection<string> PlayerNames { get => playerNames; set { playerNames = value; OnPropertyChaned("PlayerNames"); } }
        public void AddPlayer(string playerName)
        {
            if (playerNames.Contains(playerName)) return;
            playerNames.Add(playerName);
            OnPropertyChaned(playerName);

        }
        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChaned(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }


}

namespace _14._3
{
    [Serializable]
    public enum ComputerSkillLevel
    {
        Dumb,
        Good,
        Cheats
    }
}